<?php
namespace app\index\service;


use app\index\model\BondFanModel;
use app\index\model\BondJiaoModel;
use app\index\model\BondShouModel;
use app\index\model\BondTuiModel;
use app\index\model\CertEmpbuModel;
use app\index\model\CertEmployModel;
use app\index\model\CertUseModel;
use app\index\model\ContractBianModel;
use app\index\model\ContractBuModel;
use app\index\model\ContractBuyModel;
use app\index\model\ContractCaiJieModel;
use app\index\model\ContractCaiModel;
use app\index\model\ContractDayModel;
use app\index\model\ContractLianModel;
use app\index\model\ContractShiJieModel;
use app\index\model\ContractShiModel;
use app\index\model\DaiKouQiModel;
use app\index\model\DeviceJinModel;
use app\index\model\DeviceTuiModel;
use app\index\model\DeviceYunModel;
use app\index\model\EnginBudbianModel;
use app\index\model\EnginBudgetModel;
use app\index\model\EnginChanModel;
use app\index\model\EnginGodanModel;
use app\index\model\EnginSpeedModel;
use app\index\model\EnginStampModel;
use app\index\model\EnginVisaModel;
use app\index\model\EnginXunModel;
use app\index\model\EnginZhengModel;
use app\index\model\LabourYongModel;
use app\index\model\PiaokaiModel;
use app\index\model\PiaoShouModel;
use app\index\model\PiaoTaxModel;
use app\index\model\ShouHuanModel;
use app\index\model\ShouQiModel;
use app\index\model\ShouTouModel;
use app\index\model\ShouXiangModel;
use app\index\model\SpeedMonthModel;
use app\index\model\SpeedZongModel;
use app\index\model\StuffChuModel;
use app\index\model\StuffRuModel;
use app\index\model\StuffTuiModel;
use app\index\model\WageModel;
use app\index\model\WuCaiModel;
use app\index\model\WuChuModel;
use app\index\model\WuLingModel;
use app\index\model\WuRuModel;
use app\index\model\ZhiDaybaoModel;
use app\index\model\ZhiDayfuModel;
use app\index\model\ZhiEnbaoModel;
use app\index\model\ZhiJieModel;
use app\index\model\ZhiJintuiModel;
use app\index\model\ZhiLianjieModel;
use app\index\model\ZhiTouModel;
use app\index\model\ZhiXiangModel;

class BianhaoService extends CommonService
{
    public function create_shou_tou_number(){
        $tou = 'TBFSQ-';
        $daystr = substr(date("Ymd"), 2);
        $number = ShouTouModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_zhi_tou_number(){
        $tou = 'TBFZF-';
        $daystr = substr(date("Ymd"), 2);
        $number = ZhiTouModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_contract_shi_number(){
        $tou = 'SRHT-';
        $daystr = substr(date("Ymd"), 2);
        $number = ContractShiModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_contract_bu_number($minfo){
        $shiInfo = ContractShiModel::where(['id'=>$minfo['shiid']])->find();
        $num_shu = ContractBuModel::where(['shiid'=>$minfo['shiid']])->order('num_shu DESC')->value('num_shu');
        if($num_shu){
            $num_shu += 1;
        }else{
            $num_shu = 1;
        }
        $num_shu_str = str_pad($num_shu, 3, '0', STR_PAD_LEFT);

        $number = $shiInfo['number']."-".$num_shu_str;

        ContractBuModel::where(['id'=>$minfo['id']])->update([
            'num_shu' => $num_shu,
            'number' => $number,
        ]);

        return true;
    }
    public function create_engin_visa_number(){
        $tou = 'GCQZ-';
        $daystr = substr(date("Ymd"), 2);
        $number = EnginVisaModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_engin_chan_number(){
        $tou = 'CZYB-';
        $daystr = substr(date("Ymd"), 2);
        $number = EnginChanModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_contract_shi_jie_number(){
        $tou = 'SRHTJS-';
        $daystr = substr(date("Ymd"), 2);
        $number = ContractShiJieModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_shou_xiang_number(){
        $tou = 'XMSK-';
        $daystr = substr(date("Ymd"), 2);
        $number = ShouXiangModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_piao_kai_number(){
        $tou = 'KP-';
        $daystr = substr(date("Ymd"), 2);
        $number = PiaokaiModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_engin_budget_number(){
        $tou = 'CBYS-';
        $daystr = substr(date("Ymd"), 2);
        $number = EnginBudgetModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_engin_budbian_number($minfo){
        $budgetInfo = EnginBudgetModel::where(['id'=>$minfo['budgetid']])->find();
        $num_shu = EnginBudbianModel::where(['budgetid'=>$minfo['budgetid']])->order('num_shu DESC')->value('num_shu');
        if($num_shu){
            $num_shu += 1;
        }else{
            $num_shu = 1;
        }
        $num_shu_str = str_pad($num_shu, 3, '0', STR_PAD_LEFT);

        $number = $budgetInfo['number']."-".$num_shu_str;

        EnginBudbianModel::where(['id'=>$minfo['id']])->update([
            'num_shu' => $num_shu,
            'number' => $number,
        ]);

        return true;
    }
    public function create_contract_cai_number(){
        $tou = 'ZCHT-';
        $daystr = substr(date("Ymd"), 2);
        $number = ContractCaiModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_contract_bian_number($minfo){
        $caiInfo = ContractCaiModel::where(['id'=>$minfo['caiid']])->find();
        $num_shu = ContractBianModel::where(['caiid'=>$minfo['caiid']])->order('num_shu DESC')->value('num_shu');
        if($num_shu){
            $num_shu += 1;
        }else{
            $num_shu = 1;
        }
        $num_shu_str = str_pad($num_shu, 3, '0', STR_PAD_LEFT);

        $number = $caiInfo['number']."-".$num_shu_str;

        ContractBianModel::where(['id'=>$minfo['id']])->update([
            'num_shu' => $num_shu,
            'number' => $number,
        ]);

        return true;
    }
    public function create_contract_cai_jie_number(){
        $tou = 'ZCHTJS-';
        $daystr = substr(date("Ymd"), 2);
        $number = ContractCaiJieModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_contract_buy_number(){
        $tou = 'CGD-';
        $daystr = substr(date("Ymd"), 2);
        $number = ContractBuyModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_piao_shou_number(){
        $tou = 'XMSP-';
        $daystr = substr(date("Ymd"), 2);
        $number = PiaoShouModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_zhi_xiang_number(){
        $tou = 'XMFK-';
        $daystr = substr(date("Ymd"), 2);
        $number = ZhiXiangModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_zhi_enbao_number(){
        $tou = 'XMFYBX-';
        $daystr = substr(date("Ymd"), 2);
        $number = ZhiEnbaoModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_contract_lian_number(){
        $tou = 'LYHT-';
        $daystr = substr(date("Ymd"), 2);
        $number = ContractLianModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_dai_kou_qi_number(){
        $tou = 'DKDJ-';
        $daystr = substr(date("Ymd"), 2);
        $number = DaiKouQiModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_zhi_jintui_number(){
        $tou = 'JXTS-';
        $daystr = substr(date("Ymd"), 2);
        $number = ZhiJintuiModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_zhi_lianjie_number(){
        $tou = 'LYJS-';
        $daystr = substr(date("Ymd"), 2);
        $number = ZhiLianjieModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_stuff_ru_number(){
        $tou = 'CLRK-';
        $daystr = substr(date("Ymd"), 2);
        $number = StuffRuModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_stuff_chu_number(){
        $tou = 'CLCK-';
        $daystr = substr(date("Ymd"), 2);
        $number = StuffChuModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_stuff_tui_number(){
        $tou = 'CLTK-';
        $daystr = substr(date("Ymd"), 2);
        $number = StuffTuiModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_device_jin_number(){
        $tou = 'SBJC-';
        $daystr = substr(date("Ymd"), 2);
        $number = DeviceJinModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_device_yun_number(){
        $tou = 'SBYX-';
        $daystr = substr(date("Ymd"), 2);
        $number = DeviceYunModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }

    public function create_device_tui_number(){
        $tou = 'SBTC-';
        $daystr = substr(date("Ymd"), 2);
        $number = DeviceTuiModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_labour_yong_number(){
        $tou = 'YGD-';
        $daystr = substr(date("Ymd"), 2);
        $number = LabourYongModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_engin_godan_number(){
        $tou = 'GCLQD-';
        $daystr = substr(date("Ymd"), 2);
        $number = EnginGodanModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_speed_zong_number(){
        $tou = 'ZJDJH-';
        $daystr = substr(date("Ymd"), 2);
        $number = SpeedZongModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_speed_month_number(){
        $tou = 'YDJH-';
        $daystr = substr(date("Ymd"), 2);
        $number = SpeedMonthModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }

    public function create_engin_speed_number(){
        $tou = 'JDTB-';
        $daystr = substr(date("Ymd"), 2);
        $number = EnginSpeedModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_engin_xun_number(){
        $tou = 'XJ-';
        $daystr = substr(date("Ymd"), 2);
        $number = EnginXunModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }


    public function create_engin_zheng_number(){
        $tou = 'ZGBG-';
        $daystr = substr(date("Ymd"), 2);
        $number = EnginZhengModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_piao_tax_number(){
        $tou = 'SFYJ-';
        $daystr = substr(date("Ymd"), 2);
        $number = PiaoTaxModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_zhi_jie_number(){
        $tou = 'BYJJZ-';
        $daystr = substr(date("Ymd"), 2);
        $number = ZhiJieModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_shou_huan_number(){
        $tou = 'BYJHK-';
        $daystr = substr(date("Ymd"), 2);
        $number = ShouHuanModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_zhi_daybao_number(){
        $tou = 'RCFYBX-';
        $daystr = substr(date("Ymd"), 2);
        $number = ZhiDaybaoModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_zhi_dayfu_number(){
        $tou = 'RCFK-';
        $daystr = substr(date("Ymd"), 2);
        $number = ZhiDayfuModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_shou_qi_number(){
        $tou = 'QTSK-';
        $daystr = substr(date("Ymd"), 2);
        $number = ShouQiModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_contract_day_number(){
        $tou = 'RCZCHT-';
        $daystr = substr(date("Ymd"), 2);
        $number = ContractDayModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_bond_shou_number(){
        $tou = 'BZJSQ-';
        $daystr = substr(date("Ymd"), 2);
        $number = BondShouModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_bond_jiao_number(){
        $tou = 'BZJJN-';
        $daystr = substr(date("Ymd"), 2);
        $number = BondJiaoModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_bond_tui_number(){
        $tou = 'BZJTH-';
        $daystr = substr(date("Ymd"), 2);
        $number = BondTuiModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_bond_fan_number(){
        $tou = 'BZJFH-';
        $daystr = substr(date("Ymd"), 2);
        $number = BondFanModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_cert_employ_number(){
        $tou = 'PFHT-';
        $daystr = substr(date("Ymd"), 2);
        $number = CertEmployModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_cert_use_number(){
        $tou = 'XMYZ-';
        $daystr = substr(date("Ymd"), 2);
        $number = CertUseModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_cert_empbu_number($minfo){
        $midinfo = CertEmployModel::where(['id'=>$minfo['mid']])->find();
        $num_shu = CertEmpbuModel::where(['mid'=>$minfo['mid']])->order('num_shu DESC')->value('num_shu');
        if($num_shu){
            $num_shu += 1;
        }else{
            $num_shu = 1;
        }
        $num_shu_str = str_pad($num_shu, 3, '0', STR_PAD_LEFT);

        $number = $midinfo['number']."-".$num_shu_str;

        CertEmpbuModel::where(['id'=>$minfo['id']])->update([
            'num_shu' => $num_shu,
            'number' => $number,
        ]);

        return true;
    }
    public function create_wu_cai_number(){
        $tou = 'WPCG-';
        $daystr = substr(date("Ymd"), 2);
        $number = WuCaiModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }

    public function create_wu_ru_number(){
        $tou = 'WPRK-';
        $daystr = substr(date("Ymd"), 2);
        $number = WuRuModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }


    public function create_wu_chu_number(){
        $tou = 'WPCK-';
        $daystr = substr(date("Ymd"), 2);
        $number = WuChuModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_wu_ling_number(){
        $tou = 'WPLY-';
        $daystr = substr(date("Ymd"), 2);
        $number = WuLingModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }

    public function create_wage_number($month){
        $tou = 'GZB-';
        $daystr = substr(date("Ym", strtotime($month.'-01')), 2);
        $number = WageModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
    public function create_engin_stamp_number(){
        $tou = 'XMGZ-';
        $daystr = substr(date("Ymd"), 2);
        $number = EnginStampModel::where('number','like','%'.$tou.$daystr.'%')->order('number DESC')->value('number');
        if(!$number){
            $str = $tou.$daystr.'00001';
        }else{
            $str = $tou.((int)str_replace($tou,'',$number)+1);
        }
        return $str;
    }
}
